<%@ tag import="java.util.ArrayList"%>
<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ attribute name="loggedInUser" type="no.ntnu.tdt4237.User" %>
<%@ attribute name="userList" type="java.util.ArrayList" %>
<%@ attribute name="Database" type="no.ntnu.tdt4237.Database" %>
<%

boolean loggedIn = loggedInUser != null;
ArrayList<String> userList = new ArrayList<String>();
userList.addAll(Database.getUserNames());
%>

<div class="menu">
<%
if (loggedIn)
{
	%>
	<span><a href="/profile/${loggedInUser.userName}">Profile</a></span>
	<span><a href="/blog/${loggedInUser.userName}">Your blog</a></span>
	<span><a href="/newpost.jsp">New Blog Post</a></span>
	<span><a href="/users">Users</a></span>
	<span><a href="/logout.jsp">Log out</a></span>
	<%
}
else
{
	%>
	<span><a href="/index.jsp">Log in</a></span>
	<span><h5>Bloggere:</h5> </span>
	<%
	for (String s: userList){
		String temp = "/blog/"+s;
		%><span><a href="<%=temp%>"><%=s%></a></span><%
	}
}
%>
<span></span>
</div>
